#!/bin/sh

prefix="/opt"
PATH=${prefix}/bin:${prefix}/sbin:/sbin:/bin:/usr/sbin:/usr/bin
OPID=/opt/var/run/sshd.pid

start() {
	echo "starting sshd..."
	/opt/sbin/sshd
	}

stop() {
	echo "stopping sshd..."
	kill `cat $OPID`
	}

status() {
	if [ -f $OPID ]; then
		echo "PID of sshd is `cat $OPID`"
	else
		echo "sshd is not running"
	fi
	}

case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        restart)
                stop
                sleep 3
                start
                ;;
        status) status
                ;;
        *)
                echo "Usage: $0 (start|stop|restart|status)"
                exit 1
                ;;
esac

exit 0